package acm.pta10;

import org.junit.Test;

import java.util.BitSet;
import java.util.Scanner;

public class 谷歌的招聘 {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        sc.nextInt();
        int k = sc.nextInt();
        sc.nextLine();
        StringBuilder str=new StringBuilder(sc.nextLine());
        System.out.println(fun(str,k));
    }

    public static String fun(StringBuilder str,int k){
        int m=str.length()-k+1;
        for (int i = 0; i < m; i++) {
            String s = str.substring(i, i+k);
            if (isPrime(Integer.parseInt(s))) return s;
        }
        return "404";
    }
    public static boolean isPrime(int n){
        if (n<2) return false;
        int m= (int) Math.sqrt(n);
        for (int i = 2; i <= m; i++) {
            if (n%i==0) return false;
        }
        return true;
    }
}
